package com.woniu.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * power
 * @author 
 */
@NoArgsConstructor
@AllArgsConstructor
@Data
public class Power implements Serializable {
    private Integer powerId;
    //子节点
    private List<Power> children =new  ArrayList<Power>();
    //是否为打开状态
    private boolean open;
    //是否为选中状态
    private boolean checked;
    private Integer rpId;

    private String powerNmae;

    private Integer parentId;

    private String powerUrl;

    private String powerMenu;

    private static final long serialVersionUID = 1L;

    public Integer getPowerId() {
        return powerId;
    }

    public void setPowerId(Integer powerId) {
        this.powerId = powerId;
    }

    public Integer getRpId() {
        return rpId;
    }

    public void setRpId(Integer rpId) {
        this.rpId = rpId;
    }

    public String getPowerNmae() {
        return powerNmae;
    }

    public void setPowerNmae(String powerNmae) {
        this.powerNmae = powerNmae;
    }

    public Integer getParentId() {
        return parentId;
    }

    public void setParentId(Integer parentId) {
        this.parentId = parentId;
    }

    public String getPowerUrl() {
        return powerUrl;
    }

    public void setPowerUrl(String powerUrl) {
        this.powerUrl = powerUrl;
    }

    public String getPowerMenu() {
        return powerMenu;
    }

    public void setPowerMenu(String powerMenu) {
        this.powerMenu = powerMenu;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Power other = (Power) that;
        return (this.getPowerId() == null ? other.getPowerId() == null : this.getPowerId().equals(other.getPowerId()))
            && (this.getRpId() == null ? other.getRpId() == null : this.getRpId().equals(other.getRpId()))
            && (this.getPowerNmae() == null ? other.getPowerNmae() == null : this.getPowerNmae().equals(other.getPowerNmae()))
            && (this.getParentId() == null ? other.getParentId() == null : this.getParentId().equals(other.getParentId()))
            && (this.getPowerUrl() == null ? other.getPowerUrl() == null : this.getPowerUrl().equals(other.getPowerUrl()))
            && (this.getPowerMenu() == null ? other.getPowerMenu() == null : this.getPowerMenu().equals(other.getPowerMenu()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getPowerId() == null) ? 0 : getPowerId().hashCode());
        result = prime * result + ((getRpId() == null) ? 0 : getRpId().hashCode());
        result = prime * result + ((getPowerNmae() == null) ? 0 : getPowerNmae().hashCode());
        result = prime * result + ((getParentId() == null) ? 0 : getParentId().hashCode());
        result = prime * result + ((getPowerUrl() == null) ? 0 : getPowerUrl().hashCode());
        result = prime * result + ((getPowerMenu() == null) ? 0 : getPowerMenu().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", powerId=").append(powerId);
        sb.append(", rpId=").append(rpId);
        sb.append(", powerNmae=").append(powerNmae);
        sb.append(", parentId=").append(parentId);
        sb.append(", powerUrl=").append(powerUrl);
        sb.append(", powerMenu=").append(powerMenu);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}